home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 March / EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso / earcd / library / grafpapr.lha / GrafPaper.rexx < prev    next >
OS/2 REXX Batch file  |  1996-02-12  |  6KB  |  198 lines

  1.  
  2. /*
  3.  
  4. Short:        Prints graph-paper of any size or type
  5. Author:       Bill Beogelein (ag775@detroit.freenet.org)
  6. Uploader:     Bill Beogelein (ag775@detroit.freenet.org)
  7. Type:         util/misc
  8. Filename:     GrafPaper.lha
  9. Version:      v1.1
  10. Release-Date: Mon 12-Feb-96 18:35:42
  11. Requires:     Arexx and WB v2.04 or higher
  12. Replaces:     GrafPaper#?.lha (v1.0)
  13. Language:     English
  14. Compression:  LHA type lh5
  15. CPU:          68000-68060
  16. Newsgroup:    comp.sys.amiga.misc
  17. Organization: Amiga ShareWare HeadQuarters BBS 810-473-2020
  18. Keywords:     Graph, Paper, Graph-Paper, Print, Grid, Printer
  19.  
  20. You decide:
  21.    Number of boxes across and down.
  22.    Width and height of each box.
  23.    Left and top margins.
  24.  
  25. Usage...
  26. > rx GrafPaper.rexx >par: XMARGIN=10 XSIZE=5 XCOUNT=8  YMARGIN=6 YSIZE=4 YCOUNT=12 HEADER=My_Title
  27.  
  28. The above cmd will:
  29. > Indent 10 spaces for left margin.
  30. > Draw boxes 5 spaces wide.
  31. > Place 8 boxes across the page.
  32. > and...
  33. > Have a top margin of 6 lines.
  34. > Each box will be 4 chars high.
  35. > Place 12 boxes down the page.
  36.  
  37. Valid ranges for XMARGIN, XSIZE, YMARGIN, and YSIZE:  0-999.
  38. Valid ranges for XCOUNT and YCOUNT:  1-999.
  39.  
  40. Options (need additional parameters):
  41. >  XSIZE=3                    Make each box x chars wide.
  42. >  XCOUNT=23                  Make x boxes across the page.
  43. >  XMARGIN=4                  Index x spaces for left margin.
  44. >  YSIZE=6                    Make each box x chars high.
  45. >  YCOUNT=12                  Make x boxes down the page.
  46. >  YMARGIN=2                  Skip x lines for top margin.
  47. >  HEADER=My_Title_Line       Print this at top of page.
  48. >  FOOTER=My_Bottom_Line      Print this at end of page.
  49.  
  50. Keywords:
  51. >  DOUBLE         Make double-lined graph paper.  (Default is single-lined.)
  52. >  CROSS          Make graph paper out of crosses, not boxes.
  53. >  HELP           Show HELP template.
  54. >  NORMAL         10 chars/inch.  Good for  1-42 columns.
  55. >  SMALL          12 chars/inch.  Good for 43-52 columns.
  56. >  SMALLER        15 chars/inch.  Good for 53-70 columns.
  57.  
  58. Author Info:
  59.    Bill Beogelein
  60.    Box 530441
  61.    Livonia, MI 48153
  62.    BBS 810-473-2020, 28k8, Fido 1:2410/207, ag775@detroit.freenet.org
  63.  
  64. If you wish to view the IBM graphic characters in the CLI window, issue
  65. a DOS-cmd like "SetFont IBM 8".  To restore your CLI to the default font,
  66. issue a DOS-cmd like "SetFont topaz 8".
  67.  
  68. $VER: rexx:GrafPaper.rexx v1.1 Mon 12-Feb-96 18:35:42
  69.    Added HEADER and FOOTER options.
  70.    Released into Aminet.
  71.  
  72. $VER: rexx:GrafPaper.rexx v1.0 Sun 13-Feb-94 21:10:18
  73.    Beta testing
  74.    rx rexx:GrafPaper.rexx >par: XSIZE=1 XCOUNT=39 YCOUNT=88
  75.  
  76. Future plans:
  77.    Allow spaces in HEADER and FOOTERs.
  78.    Number the boxes TOP, RIGHT, BOTTOM, LEFT.
  79.  
  80. Ignore:
  81.    lz    u dh3:a/6.8/GrafPaper.lha rexx:GrafPaper.rexx a:zzzBBS
  82.    lz -r u dh3:a/6.8/GrafPaper.lha C:SetFont Fonts:IBM Fonts:IBM.font
  83.  
  84. */
  85.  
  86. /****** Top of user-settable variables ******/
  87.  
  88. cpiCode.1 = "27 80 "    /* Your printer's 10-CPI codes  */
  89. cpiCode.2 = "27 77 "    /* Your printer's 12-CPI codes  */
  90. cpiCode.3 = "27 103"    /* Your printer's 15-CPI codes  */
  91.  
  92. empCode   = "27 69"     /* Your printer's emphasized    codes */
  93. uniCode   = "27 85 1"   /* Your printer's uni-direction codes */
  94.  
  95. /****** End of user-settable variables ******/
  96.  
  97. parse arg opts
  98.  
  99. x_margin = GetKeyWrd(opts, "XMARGIN=",  4)
  100. x_size   = GetKeyWrd(opts, "XSIZE="  ,  1)
  101. x_count  = GetKeyWrd(opts, "XCOUNT=" , 37)
  102.  
  103. y_margin = GetKeyWrd(opts, "YMARGIN=",  0)
  104. y_size   = GetKeyWrd(opts, "YSIZE="  ,  0)
  105. y_count  = GetKeyWrd(opts, "YCOUNT=" , 62)
  106.  
  107. header   = GetKeyWrd(opts, "HEADER=" , ""); header= translate(header, " ", "_")
  108. footer   = GetKeyWrd(opts, "FOOTER=" , ""); footer= translate(footer, " ", "_")
  109.  
  110. o_double = GetSwitch(opts, "DOUBLE"  ,  0)
  111. o_cross  = GetSwitch(opts, "CROSS"   ,  0)
  112. o_help   = GetSwitch(opts, "HELP"    ,  0)
  113. o_small  = GetSwitch(opts, "SMALL"   ,  0)
  114. o_smaller= GetSwitch(opts, "SMALLER" ,  0)
  115.  
  116. LF  = '0a'x
  117. if(y_count="" | o_help) then
  118. do
  119.    say LF "Rexx:GrafPaper.rexx by Bill Beogelein 810-473-2020 (1:2410/207)"
  120.    say LF "rx GrafPaper.rexx >par: xMARGIN=a xSIZE=b xCOUNT=c  yMARGIN=d ySIZE=e yCOUNT=f  DOUBLE CROSS SMALL SMALLER HEADER=title FOOTER=title" LF
  121.    exit
  122. end
  123.  
  124.     /* "12345678901" */
  125. chars= "Ú¿ÃÅ´ÀÁÙij"
  126. if(o_double) then chars= "ÉË»ÌιÈʼͺ"
  127. if(o_cross) then
  128. do
  129.    chars= "Ú¿ÃÅ´ÀÁÙ  "       /* No vert or horz bars */
  130.    if(o_double) then chars= "ÉË»ÌιÈʼ  "
  131. end
  132.  
  133. if(o_small) then                 /* Set-up printer */
  134.    PrintCodes(cpiCode.2)
  135. else if(o_smaller) then
  136.    PrintCodes(cpiCode.3)
  137. else
  138.    PrintCodes(cpiCode.1)
  139.  
  140. /* PrintCodes(empCode) xxx */
  141. PrintCodes(uniCode)
  142.  
  143. h= spc(x_margin) || char(1)         /* ÉÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍÍËÍÍÍÍ» */
  144. i= copies(char(10), x_size)
  145. j= copies(i || char(2), x_count-1)
  146. say copies(LF, y_margin) || spc(x_margin) || header || LF || h || j || i || char(3)
  147.  
  148. h= spc(x_margin) || char(11)        /* º    º    º    º    º    º */
  149. i= spc(x_size) || char(11)
  150.  
  151. j= spc(x_margin) || char(4)         /* ÌÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍÍÎÍÍÍ͹ */
  152. k= copies(char(10), x_size)
  153. l= copies(k || char(5), x_count-1)
  154.  
  155. m= copies(h || copies(i, x_count) || LF, y_size)
  156. o= j || l || k || char(6)
  157. call writeCH(STDOUT, m || copies(o || LF || m, y_count-1)) /* Repeat the above 2 bars */
  158.  
  159. h= spc(x_margin) || char(7)         /* ÈÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍÍÊÍÍÍͼ */
  160. i= copies(char(10), x_size)
  161. j= copies(i || char(8), x_count-1)
  162. say h || j || i || char(9) LF || spc(x_margin) || footer || copies(LF, 2)
  163.  
  164. exit                  /*********** End of main ***********/
  165.  
  166. Spc:        PROCEDURE
  167.    parse arg n
  168. return copies(" ", n)
  169.  
  170. Char:
  171.    parse arg which
  172. return substr(chars,which,1)
  173.  
  174. PrintCodes:      PROCEDURE
  175.    parse arg buf
  176.    do i=1 to words(buf)
  177.       call writeCH(STDOUT, d2c(word(buf,i)))
  178.    end i
  179. return 1
  180.  
  181. GetSwitch:  PROCEDURE   EXPOSE opts
  182.    parse arg opts, str, def
  183.    w=find(upper(opts), upper(str))
  184.    if(w<1) then return def
  185.    opts=delword(opts, w, 1)
  186. return ~(def)        /*** End of GetSwitch ***/
  187.  
  188. GetKeyWrd:     PROCEDURE   EXPOSE opts
  189.    parse arg opts, str, def
  190.    p=pos(upper(str), upper(opts))
  191.    if(p<1) then return def
  192.    len=length(str)
  193.    s=word(substr(opts, p+len),1)
  194.    opts=delstr(opts, p, len+length(s)+1)
  195. return s             /*** End of GetKeyWrd ***/
  196.  
  197. /*** EOF rexx:GrafPaper.rexx 810-473-2020 ***/
  198.